#include "HomeBase.h"


HomeBase::HomeBase(bool isEnemy) : enemy(isEnemy)
{
}

void HomeBase::display()
{
	glPushMatrix();
		// Locate at square 1,1 (x,z plane) on the map--by default
		glTranslatef(3.5, 0.5, 2.0);

		// :::::::::::::::::::::::::
		// right-most column elements
		// :::::::::::::::::::::::::
		
		glPushMatrix();
			glTranslatef(2, 0, 0);
			// back block
			midColBlock1.greenMilitaryDisplay();
			// front-block
			glPushMatrix();
				glTranslatef(0, (GLfloat)1/4, 1);
				midColBlock2.greenMilitaryDisplay();
			glPopMatrix();
		glPopMatrix();

		// :::::::::::::::::::::
		// Right-column elements
		// :::::::::::::::::::::
		
		glPushMatrix();
			glTranslatef(1, 0, -0.5);
			// back block
			glPushMatrix();	
				glTranslatef(0, 0.25 ,0);
				leftColBack.greenMilitaryDisplay();
			glPopMatrix();
			// front small (x3) blocks
			for(int i=1; i!=4; ++i)
			{
				glPushMatrix();
					glTranslatef(0, -0.25, i);
					leftSmallBlock.greenMilitaryDisplay(i);
				glPopMatrix();
			}
		glPopMatrix();

		// :::::::::::::::::::
		// MID-column elements
		// :::::::::::::::::::

		// back block
		midColBlock1.greenMilitaryDisplay();
		// center-block
		glPushMatrix();
			glTranslatef(0, (GLfloat)1/4, 1);
			midColBlock2.greenMilitaryDisplay(enemy);
		// front (small) block
			glTranslatef(0, -0.5 ,1);
			midColSmallBlock.greenMilitaryDisplay(3);
		glPopMatrix();

		// :::::::::::::::::::
		// left-column elements
		// :::::::::::::::::::
		
		glPushMatrix();
			glTranslatef(-1, 0, -0.5);
			// back block
			glPushMatrix();	
				glTranslatef(0, 0.25 ,0);
				leftColBack.greenMilitaryDisplay();
			glPopMatrix();
			// front small (x3) blocks
			for(int i=1; i!=4; ++i)
			{
				glPushMatrix();
					glTranslatef(0, -0.25, i);
					leftSmallBlock.greenMilitaryDisplay(i);
				glPopMatrix();
			}
		glPopMatrix();

		// ::::::::::::::::::::::::::::::::::::
		// flag-column (left-most col) elements
		// ::::::::::::::::::::::::::::::::::::

		glPushMatrix();
			glTranslatef(-2, 0, 0);
			// back block
			midColBlock1.greenMilitaryDisplay();
			// front-block
			glPushMatrix();
				glTranslatef(0, (GLfloat)1/4, 1);
				midColBlock2.greenMilitaryDisplay();
			glPopMatrix();
		glPopMatrix();

		
		// :::::::::
		// Flag 
		// :::::::::

		glPushMatrix();
			if(enemy)
			{
				// put on the right side
				glTranslatef(2, 0.5, 1);
			}
			else
			{
				// put on the left side
				glTranslatef(-2, 0.5, 1);
			}
			flag.display();
		glPopMatrix();


		//// ::::::::::::
		//// Team number
		//// ::::::::::::
		//if(!enemy)
		//{
		//	glColor3f(0.85, 0, 0);
		//	glPushMatrix();
		//		glTranslatef(0, 0.5 + 0.045, 0.7);
		//		glPushMatrix();
		//			glTranslatef(0.08, 0, 0.3);
		//			glRotatef(65, 0,1,0 );
		//			glScalef(0.6, 0.045, 0.1);
		//			glutSolidCube(1.0);
		//		glPopMatrix();
		//		glPushMatrix();
		//			glScalef(0.5, 0.045, 0.1);
		//			glutSolidCube(1.0);
		//		glPopMatrix();
		//	glPopMatrix();
		//}

	glPopMatrix();
}

HomeBase::~HomeBase(void)
{
}
